/**
 * Copyright (c) 2019 xstgongyi.org
 * All rights reserved.
 */
package org.xstgongyi.eduaid.controller;

import org.xstgongyi.eduaid.dataobject.VirtualPerson;
import org.xstgongyi.eduaid.dataobject.VolunteerDO;

/**
 * @author oldcrane<br/>
 * @created 2019-04-18
 */
public class VolunteerControllerHelper {

	static VolunteerDO merge(VolunteerDO dbObj, VolunteerDO inputObj) {
		VolunteerDO result = (VolunteerDO) mergeInputToDbObj(dbObj, inputObj);
		return result;
	}

	static VirtualPerson mergeInputToDbObj(VirtualPerson dbObj, VirtualPerson inputObj) {
		if (null == dbObj) {
			return null;
		}
		if (null == inputObj) {
			return dbObj;
		}

		if (null != inputObj.getAnonymous()) {
			dbObj.setAnonymous(inputObj.getAnonymous());
		}
		if (null != inputObj.getArea()) {
			dbObj.setArea(inputObj.getArea());
		}
		if (null != inputObj.getBirthday()) {
			dbObj.setBirthday(inputObj.getBirthday());
		}
		if (null != inputObj.getContactAddress()) {
			dbObj.setContactAddress(inputObj.getContactAddress());
		}
		if (null != inputObj.getContactEmail()) {
			dbObj.setContactEmail(inputObj.getContactEmail());
		}
		if (null != inputObj.getContactOther()) {
			dbObj.setContactOther(inputObj.getContactOther());
		}
		if (null != inputObj.getContactPhone()) {
			dbObj.setContactPhone(inputObj.getContactPhone());
		}
		if (null != inputObj.getContactWechat()) {
			dbObj.setContactWechat(inputObj.getContactWechat());
		}
		if (null != inputObj.getGender()) {
			dbObj.setGender(inputObj.getGender());
		}
		if (null != inputObj.getName()) {
			dbObj.setName(inputObj.getName());
		}
		if (null != inputObj.getNickname()) {
			dbObj.setNickname(inputObj.getNickname());
		}
		if (null != inputObj.getRemark()) {
			dbObj.setRemark(inputObj.getRemark());
		}
		return dbObj;
	}

}
